import axios from './ajax'
import type { ResDataType } from './ajax'
import {sleep} from './question'

// 获取用户信息
export async function getUserInfoService(): Promise<ResDataType> {
  // const url = `/api/question/${id}`
  // const data = (await axios.get(url)) as ResDataType
  const data = {
    username: '张三',
    nickname: '法外狂徒'
  }
  await sleep()
  return data
}

// 注册用户
export async function registerService(username: string, password: string, nickname?: string): Promise<ResDataType> {
  // const url = `/api/question/${id}`
  // const data = (await axios.get(url)) as ResDataType
  const data = {
    errno: 0
  }
  return data
}

// 登录
export async function loginService(username: string, password: string): Promise<ResDataType> {
  // const url = `/api/question/${id}`
  // const data = (await axios.get(url)) as ResDataType
  const data = {
    token: 'qwerty123456'
  }
  return data
}